package observer;

/**
 * @author wcj
 * @Date 2021/6/23 22:15
 * @Version 1.0
 */
public class ConcreteSubject extends Observer {

 private String name;

 private Subject subject;

 public ConcreteSubject(String name, Subject subject) {
  this.name = name;
  this.subject = subject;
  this.subject.addObserver(this);
 }

 @Override
 public void update() {
  System.out.println(this.name + "receive Subject state change：" + subject.state);
 }
}
